from django.db import models

# Create your models here.

class Books(models.Model):
    name = models.CharField(max_length=100,verbose_name='图书'),
    author = models.CharField(max_length=100,verbose_name='作者'),
    status = models.BooleanField(default=True,verbose_name='状态'),

    class Meta:
       db_table = 'books'
       verbose_name = '图书表'

    def __str__(self):
        return self.name


class Record(models.Model):
    book = models.ForeignKey(Books, on_delete=models.CASCADE,verbose_name='图书'),
    b_time = models.DateTimeField(auto_now_add=True,verbose_name='开始时间'),
    e_time = models.DateTimeField(auto_now=True,verbose_name='结束时间'),
    name = models.CharField(max_length=100,verbose_name='借阅人'),
    status = models.BooleanField(default= False,verbose_name='还书状态'),

    class Meta:
        db_table = 'Record'